package cn.edu.zzuli.common.result;

import org.springframework.stereotype.Component;

@Component
public class Result {

    public static ResultInfo ok(){
        return new ResultInfo(200);
    }

    public static ResultInfo ok(Object result){
        ResultInfo resultInfo = new ResultInfo();
        resultInfo.setCode(200);
        resultInfo.setData(result);
        return resultInfo;
    }

   public static ResultInfo fail(){
       return new ResultInfo(500);
   }

   public static ResultInfo fail(String message){
       ResultInfo resultInfo = new ResultInfo();
       resultInfo.setCode(500);
       resultInfo.setMsg(message);
       return resultInfo;
   }
}
